// color
export const DEFAULT_BG_COLOR = 'red'
export const BG_COLORS = [
  {
    name: 'red',
    color: 'rgb(255, 215, 215)'
  },
  {
    name: 'blue',
    color: 'rgb(215, 250, 255)'
  },
  {
    name: 'yellow',
    color: 'rgb(255, 244, 224)'
  },
  {
    name: 'purple',
    color: 'rgb(249, 229, 255)'
  }
]

export function backgroundImage(value, defaultColor = DEFAULT_BG_COLOR) {
  var image = value || defaultColor
  var bgName = BG_COLORS.find(item => {
    return item.name === value
  })
  if (bgName) {
    image = require(`@/assets/images/bg/${bgName.name}.png`)
  }
  return {
    backgroundImage: `url(${image})`
  }
}
